package com.common.www.bean.entity.auth;

import org.springframework.boot.base.jpa.domain.entity.NumberIdentityEntity;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;

@Entity
@DynamicUpdate(true)
@DynamicInsert(true)
@Getter
@Setter
@ToString()
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Table(name = "auth_token")
public class Token extends NumberIdentityEntity {
    private static final long serialVersionUID = -767069309287041077L;
    @Column(length = 256)
    private String token;

    @Column
    private Long lastUpdateTimetamp = new Date().getTime();

    //用户id，这里不用级联查询
    @Column(length = 64)
    private String user;
}
